#include <iostream>
#include <string>
#include <stack>
using namespace std;

int main()
{
	stack<int> s;
	string str;
	cin >> str;
	int tmp = 0;
	int flag = 0;
	for (int i = 0;i < str.size();i++) {
		char c = str[i];
		if (c == '.') {
			s.push(tmp);
			flag = 0;
			continue;
		}
		else if (c == '@')
			break;
		else if (c >= '0' && c <= '9') {
			if (flag == 0) {
				flag = 1;
				tmp = c - '0';
			}
			else if (flag == 1) {
				tmp = tmp * 10 + c - '0';
			}
		}
		else {
			int b = s.top();
			s.pop();
			int a = s.top();
			s.pop();
			if (c == '+')
				s.push(a + b);
			else if (c == '-')
				s.push(a - b);
			else if (c == '*')
				s.push(a * b);
			else if (c == '/')
				s.push(a / b);
		}
	}
	cout << s.top() << endl;
	return 0;
}